package com.aaa.excel;

import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: qy158-system
 * @description:
 * @author: 闫克起2
 * @create: 2022-10-15 09:27
 **/
public class TestWriterDemo {

    public static void main(String[] args) {
        //filename:表示excel文件所在路径以及名称
        String fileName = "D:\\web-project\\qy158-system\\qy158writer.xlsx";
        // 这里 需要指定写用哪个class去写，然后写到第一个sheet，名字为模板 然后文件流会自动关闭
        // 如果这里想使用03 则 传入excelType参数即可

        List<ExcelDemo> data=new ArrayList<>();
        data.add(new ExcelDemo("王俊凯",17,"男","北京"));
        data.add(new ExcelDemo("王源",18,"男","商丘"));
        data.add(new ExcelDemo("易烊千玺",18,"男","郑州"));
        data.add(new ExcelDemo("王一博",19,"男","郑州"));
        EasyExcel.write(fileName, ExcelDemo.class).sheet("最牛老闫").doWrite(data);
    }
}
